//app.js
// 引入polyfill解决"define is not defined"等兼容性问题
require('./utils/polyfill.js');

App({
  onLaunch: function () {
    let login = wx.getStorageSync('isLogin') || false
    if(login){
      this.globalData.userinfo = wx.getStorageSync('userinfo') || null
      this.globalData.usertype = wx.getStorageSync('usertype') || null
      this.globalData.isLogin = login
    }
    wx.setStorageSync('isLogin', login)

    // 初始化文件列表
    this.globalData.fileList = wx.getStorageSync('fileList') || []

    // 展示本地存储能力
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
  },
  globalData: {
    userinfo: null,
    usertype: null,
    isLogin: false,
    lastScanResult: null, // 添加全局变量存储最后的扫描结果
    fileList: [] // 添加全局变量存储文件列表
  }
})